import { EggAppConfig, PowerPartial } from "egg";

export default () => {
  const config: PowerPartial<EggAppConfig> = {};

  // 开发环境MySQL配置
  config.mysql = {
    client: {
      host: "localhost",
      port: "3306",
      user: "root",
      password: "12345678", // 请输入您的MySQL密码
      database: "sso_system",
      authProtocol: "mysql_native_password", // 设置认证协议
      charset: "utf8mb4",
      acquireTimeout: 60000,
      timeout: 60000,
      reconnect: true
    },
    app: true, // 启用MySQL连接
    agent: false
  };

  // 使用内存存储Egg Session（与自定义SSO_SESSION_ID无关）
  config.session = {
    key: "EGG_SESS",
    maxAge: 24 * 3600 * 1000,
    renew: true,
    secure: false,
    httpOnly: true,
    sameSite: "lax",
    path: "/",
    domain: "",
    signed: true
  };

  return config;
};
